//
//  ViewController.m
//  DrawArc
//
//  Created by Misheral on 15/7/1.
//  Copyright (c) 2015年 lifecycle. All rights reserved.
//

#import "ViewController.h"
#import "ArecView.h"
#import "AViewController.h"

@interface ViewController ()<UINavigationControllerDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.navigationController.navigationBar.translucent = NO;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationItem.title = @"动画以及画圆以及设置web的header和footer";
    self.title = @"nav 动画";
//    ArecView *aview = [[ArecView alloc] initWithFrame:self.view.bounds];
//    aview.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
//    aview.backgroundColor = [UIColor greenColor];
//    [self.view addSubview:aview];
    
    self.navigationController.delegate = self;
    
//    UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
//    web.scrollView.contentInset = UIEdgeInsetsMake(100, 0, 0, 0);

//    web.backgroundColor = [UIColor redColor];
//    web.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
//    [self.view addSubview:web];
    
//    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake( 0, -100, web.frame.size.width, 100)];
//    headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//    headerView.backgroundColor = [UIColor blueColor];
//    [web.scrollView addSubview:headerView];
//
//    web.scrollView.backgroundColor = [UIColor greenColor];
//    
//    dispatch_async(dispatch_get_main_queue(), ^{
//        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.baidu.com"]]];
//    });
    
    //对于自定义的nav的返回按钮，需要在rootviewController里面开启右滑返回，其余任何一层凡是自定义的试图，开启这个都不管用
    self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


//pageCurl      向上翻一页
//pageUnCurl  向下翻一页
//rippleEffect   滴水效果
//suckEffect    收缩效果，如一块布被抽走
//cube            立方体效果
//oglFlip         上下翻转效果
　　//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"

- (IBAction)goNext:(id)sender {
    CATransition *animation = [CATransition animation];
    [animation setDuration:0.3];
//    [animation setType: kCATransitionMoveIn];
//    [animation setSubtype: kCATransitionFromTop];
    [animation setType:@"cube"];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
    AViewController *vc = [[AViewController alloc] init];
    vc.view.backgroundColor = [UIColor grayColor];
    
    [self.navigationController.view.window.layer addAnimation:animation forKey:nil];
    [self.navigationController pushViewController:vc animated:NO];
}
#pragma mark nav delegate

@end
